package cn.etg.day07;

import java.util.concurrent.Callable;

/**
 * 使用线程方式二创建两个线程:分别输出1000次，你好和再见
 * @author Xiloer
 *
 */
public class Test02 {
    public static void main(String[] args) {
        Runnable run1 = new way2_1();
        Runnable run2 = new way2_2();
        Thread th1 = new Thread(run1);
        Thread th2 = new Thread(run2);
        th1.start();
        th2.start();
    }
}
class way2_1 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("你好");
        }
    }
}
class way2_2 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("再见");
        }
    }
}